
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>

//#include "ros/ros.h"
//#include "std_msgs/String.h"

using namespace cv;  
using namespace std; 
int main(int argc, char** argv)  
{  
    
  
   //ros::init(argc, argv, "test");  
  
    Mat image;  
	int cam_idx = 0;

    if (argc == 2) {
        cam_idx = atoi(argv[1]);
    }

    VideoCapture cap(cam_idx);
    if (!cap.isOpened()) {
        cerr << "Could not open camera." << endl;
        exit(EXIT_FAILURE);
    }
    namedWindow("Display Image"); 
    
	for(;;){
	  cap >> image; 
	  imshow("Display Image", image);  
      waitKey(5);
	}
	 

	//ros::spin();
    return 0;  
}




















